/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.ekuma.epos.qkorder.report;

import java.util.List;
import net.sf.jasperreports.engine.JRAbstractScriptlet;
import net.sf.jasperreports.engine.JRDataSource;
import net.sf.jasperreports.engine.JRScriptletException;
import net.sf.jasperreports.engine.data.JRBeanCollectionDataSource;

/**
 *
 * @author Administrator
 */
public class MainReportScriptlet extends JRAbstractScriptlet{

    @Override
    public void beforeReportInit() throws JRScriptletException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void afterReportInit() throws JRScriptletException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void beforePageInit() throws JRScriptletException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void afterPageInit() throws JRScriptletException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void beforeColumnInit() throws JRScriptletException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void afterColumnInit() throws JRScriptletException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void beforeGroupInit(String arg0) throws JRScriptletException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void afterGroupInit(String arg0) throws JRScriptletException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void beforeDetailEval() throws JRScriptletException {
       System.out.println("afterDetailEval...");
       List subList = (List)getFieldValue("pageLines");
       JRDataSource jr = new JRBeanCollectionDataSource(subList);
       /**
        *该值是在父报表中定义的一个变量Variables,
        *类型为net.sf.jasperreports.engine.JRDataSource
         *（就是上图的变量设置）
        **/
         setVariableValue("pageLines", jr);
    }

    @Override
    public void afterDetailEval() throws JRScriptletException {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
